<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>NB-loT数据平台</title>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <!-- <meta name="viewport" content="initial-scale=1, maximum-scale=1"> -->
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="/h5/dist/css/light7.min.css">
    <link rel="stylesheet" href="/h5/dist/css/light7-swiper.min.css">
    <link rel="stylesheet" type="text/css" href="/h5/css/login.css">
    <link rel="stylesheet" type="text/css" href="/h5/css/fonts/iconfont.css">

  </head>
  <body>
    <div class="page page-current logins" id='login'>
      <div class="contentLogin">
        <h2 class="login-title"><i class="iconfont icon-leaf "></i>NB-loT数据平台</h2>
        <div class="list-item login">
          <ul>
            <!-- Text inputs -->
            <li>
              <div class="item-group login">
                  <i class="iconfont icon-zhanghao"></i>
                  <input type="text" name="" id="username" placeholder="账号" value="userdan">
              </div>
            </li>
            <li>
              <div class="item-group login">
                  <i class="iconfont icon-password_icon"></i>
                  <input type="password" id="password" name="" placeholder="密码" value="12345678">
              </div>
            </li>
            <li class="display-flex">
              <div class="item-group login mr1">
                  <i class="iconfont icon-yanzhengma"></i>
                  <input type="text" name="" id="imagecode" placeholder="验证码" >
              </div>
              <div class="item-group login">
                  <img id="getcode" onclick="get_img_code()"  style="width: 100%;height: 100%; background: #fff;" alt="验证码"/>
              </div>
            </li>
          </ul>
        </div>
        <div class="content-block prl2 w100">
          <p class="button-box-shodow"><a href="#" class="button button-fill button-white" onclick="Dologin()">登录</a></p>
        </div>
      </div>
    </div>
    <script type='text/javascript' src='/h5/dist/js/jquery.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/h5/dist/js/light7.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/h5/dist/js/light7-swiper.min.js' charset='utf-8'></script>
    <script src="/javascripts/des.js"></script>
    <script type="text/javascript">
      $(document).ready(function(){
        get_img_code();
      })
      function get_img_code(){
        var img = document.getElementById("getcode");
        var randomnum = Math.random();
        img.src="/account/getVerifyimg?"+randomnum;
      }
      function Dologin() {
        var username = $('#username').val();
        var password = $('#password').val();
        var imagecode = $('#imagecode').val();
        if (username == "") {
            $.alert("请输入登录帐号");
            return;
        }
        if (password == "") {
            $.alert("请输入登录密码");
            return;
        }
        // if (imagecode == "") {
        //     $.alert("请输入验证码");
        //     return;
        // }
        $.ajax({
                 type: "post",
                 async: false,
                 url: "/h5/login",
                 dataType:'json',
                 "data":{
                    "usercode":username,
                    "pwd":strEnc(username+','+password+','+imagecode,1,2,3),
                    'vcode':imagecode
                 },
                 success:function(msg){
                    if(msg.statusCode=="200"){
                      console.log('11111111111111111111');
                        location.href = "/h5/index";
                    }else{
                        $.alert(msg.message);
                        get_img_code();
                        $('#imagecode').val('');
                    }
                 },
                 error:function(XMLHttpRequest, textStatus, errorThrown){
                    if(XMLHttpRequest.status){
                        location.href = "/severError";
                    }
                 }
        });
    }
    </script>
  </body>
</html>
